import { PAGE_SIZE_BASE } from '@/constants/common';
import Xhr from './axios/xhr';

const saveTheme = theme => Xhr.post('/theme', theme);
const getThemeById = id => Xhr.get(`/theme/${id}`);
const updateThemeById = (id, theme) => Xhr.put(`/theme/${id}`, theme);
const getThemeList = (index = 1, size=PAGE_SIZE_BASE, keyword = '') => Xhr.get(`/theme/list?platform=admin&pageSize=${size}&pageIndex=${index}&keyword=${keyword}`);
const deleteThemeById = id => Xhr.delete(`/theme/${id}`);

export {
  saveTheme,
  getThemeById,
  updateThemeById,
  getThemeList,
  deleteThemeById,
};
